//
//  UIView+PJAdaptScreen.h
//  SSMS
//
//  Created by yelihua on 2018/12/17.
//  Copyright © 2018 yelihua. All rights reserved.
//

#import <UIKit/UIKit.h>
#define SCREENWIDTH [[UIScreen mainScreen] bounds].size.width
#define SCREENHEIGHT [[UIScreen mainScreen] bounds].size.height

typedef NS_OPTIONS(NSInteger, PJAdaptScreenWidthType) {
    PJAdaptScreenWidthTypeNone = 0,
    PJAdaptScreenWidthTypeConstraint = 1<<0, /**< 对约束的constant等比例 */
    PJAdaptScreenWidthTypeFontSize = 1<<1, /**< 对字体等比例 */
    PJAdaptScreenWidthTypeCornerRadius = 1<<2, /**< 对圆角等比例 */
    PJAdaptScreenWidthTypeAll = 1<<3, /**< 对现有支持的属性等比例 */
};



NS_ASSUME_NONNULL_BEGIN

@interface UIView (PJAdaptScreen)

@property(nonatomic,assign)BOOL hasAdapt;

/**
 遍历当前view对象的subviews和constraints，对目标进行等比例换算,以375为基准宽度,默认 type = PJAdaptScreenWidthTypeAll , exceptViews = nil
 */
- (void)adaptScreen;

/**
 遍历当前view对象的subviews和constraints，对目标进行等比例换算,以375为基准宽度
 
 @param type 想要和基准屏幕等比例换算的属性类型
 */
- (void)adaptScreenWidthWithType:(PJAdaptScreenWidthType)type;
/**
 遍历当前view对象的subviews和constraints，对目标进行等比例换算,以375为基准宽度
 
 @param type 想要和基准屏幕等比例换算的属性类型
 @param exceptViews 需要对哪些类进行例外
 */
- (void)adaptScreenWidthWithType:(PJAdaptScreenWidthType)type exceptViews:(nullable NSArray<Class> *)exceptViews;

/**
 遍历当前view对象的subviews和constraints，对目标进行等比例换算
 
 @param type 想要和基准屏幕等比例换算的属性类型
 @param refereWidth 当前view的基准宽度
 @param exceptViews 需要对哪些类进行例外
 */
- (void)adaptScreenWidthWithType:(PJAdaptScreenWidthType)type refereWidth:(CGFloat)refereWidth exceptViews:(nullable NSArray<Class> *)exceptViews;

/**
 遍历当前view对象的subviews和constraints，对目标进行等比例换算
 
 @param type 想要和基准屏幕等比例换算的属性类型
 @param rate 倍率
 @param exceptViews 需要对哪些类进行例外
 */
- (void)adaptScreenWidthWithType:(PJAdaptScreenWidthType)type rate:(CGFloat)rate exceptViews:(nullable NSArray<Class> *)exceptViews;
@end

NS_ASSUME_NONNULL_END
